import java.util.Arrays;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * user:likai
 * Date:2022-09-17
 * Time:21:44
 */
public class Test {
    public static void transform(int[]array){
        for (int i = 0; i < array.length; i++) {
            array[i]*=2;
        }
    }
    public static void main1(String[] args) {
        int []array={1,2,3,4};
        transform(array);
        System.out.println(Arrays.toString(array));
    }

    public static double avg(int []array){
        int sum=0;
        for (int i = 0; i < array.length; i++) {
            sum+=array[i];
        }
        double a=sum*1.0/array.length;
        return a;
    }
    public static void main2(String[] args) {
        int []array={1,2,3,4};
        System.out.println(avg(array));

    }

    public static void sort1(int []array){
        int []array2=new int[array.length];
        for (int i = 0; i < array.length; i++) {
            array2[i]=array[i];

        }
        int l=0;
        int r=array.length-1;
        for (int i = 0; i < array.length; i++) {
            if(array2[i]%2==0){
                array[l]=array2[i];
                l++;
            }else{
                array[r]=array2[i];
                r--;
            }
        }
    }
    public static void main3(String[] args) {
        int []array={12,23,43,25,65,34,43};
        sort1(array);
        System.out.println(Arrays.toString(array));
    }
    public static int binaryLookup(int []array,int x){
        int l=0;
        int r=array.length-1;
        while(l<r){
            int i=(r+l)/2;
            if(array[i]>x){
                r=i+1;
            } else if (array[i]<x) {
                l=i+1;
            }else {
                return i;
            }
        }

            return -1;

    }
    public static void main4(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int x=scanner.nextInt();
        int[]array={1,2,3,4,5,6,7,8,9};
        int a=binaryLookup(array,x);
        if(a==-1){
            System.out.println("没有这个数");
        }else{
            System.out.println(a);
        }
    }

    public static void searchTarget(int []sums,int target){
        for (int i = 0; i < sums.length-1; i++) {
            for (int j = i+1; j < sums.length; j++) {
                if (sums[i] + sums[j]==target) {
                    System.out.println(i+" "+j);
                }
            }
            if(i==sums.length-1){
                System.out.println("没有这个数");
            }

        }
    }
    public static void main5(String[] args) {
        int []sums={2,4,15,16,28,48,59};
        Scanner scanner=new Scanner(System.in);
        int target=scanner.nextInt();
        searchTarget(sums,target);
    }

    public static void onlyNumber(int[]array){
        for (int i = 0; i < array.length; i++) {
            int flag=1;
            for (int j = 0; j < array.length; j++) {
                if(i!=j){
                    if(array[i]==array[j]){
                        flag--;
                    }
                }
            }
            if(flag==1){
                System.out.println(array[i]);
            }
        }
    }
    public static void main6(String[] args) {
        int[]array={1,1,2,2,3,3,4,4,5,6,6};
        onlyNumber(array);
    }

    public static void number(int []array){
        int flag=1;
        int j=array[0];
        for (int i = 1; i < array.length; i++) {
            if(flag==0){
                j=array[++i];
            }
            if(j==array[i]) {
                flag++;
            }else{
                flag--;
            }

        }
        System.out.println(j);
    }
    public static void main7(String[] args) {
        int []array={1,2,3,4,4,4,4,5,5,5,5,5,5,5,5,5,5,};
        number(array);
    }

    public static boolean IsOdd(int []array){
        for (int i = 0; i < array.length-2; i++) {
            if ((array[i] % 2 == 1) && (array[i + 1] % 2 == 1)) {
                if (array[i + 2] % 2 == 1) {
                    return true;
                }
            }
        }
        return false;
    }
    public static void main(String[] args) {
        int []array={1,2,3,4,5,7,9,1,2};
        System.out.println(IsOdd(array));
    }
}
